import time
from Base.Base import Base
from selenium.webdriver.common.by import By
from Common.Api_client import ApiClient
class EmailLoginPage(Base):
    def __init__(self, driver):
        super().__init__(driver)
        self.client = ApiClient()

    # 进入iframe框架
    def join_iframe(self):
        by, value = self.client.get_locator("email", "iframe_loc")
        self.frame((by, value))

    def send_username(self, username):
        # 动态取 username_loc 配置
        by, value = self.client.get_locator("email", "user_loc")
        self.send_keys((by, value), username)
    def send_password(self, password):
        by, value = self.client.get_locator("email", "pass_loc")
        self.send_keys((by, value), password)
    def click_login_btn(self):
        by, value = self.client.get_locator("email", "login_loc")
        self.click((by, value))